package com.master.util;

/**
 * 封装Result类中的code和msg
 */
public class CodeMsg {

    private int code;
    private String msg;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    private CodeMsg(int code,String msg){
        this.code = code;
        this.msg = msg;
    }

    //通用模块的异常
    public static CodeMsg SUCCESS  = new CodeMsg(0,"SUCCESS");
    public static CodeMsg SERVER_ERROR  = new CodeMsg(500100,"服务端异常");
    public static CodeMsg REQUEST_ILLEGAL  = new CodeMsg(500101,"请求非法");
    public static CodeMsg ACCESS_LIMIT_REACHE  = new CodeMsg(500102,"访问过于频繁");


    //登录模块
    public static CodeMsg PASSWORD_EMPTY = new CodeMsg(500211,"密码不能为空");
    public static CodeMsg PASSWORD_ERROR = new CodeMsg(500215,"密码不正确");
    public static CodeMsg MOBILE_EMPTY = new CodeMsg(500212,"手机号不能为空");
    public static CodeMsg MOBILE_ERROR = new CodeMsg(500213,"手机号格式错误");
    public static CodeMsg MOBILE_NOT_EXIST = new CodeMsg(500214,"手机号不存在");
    public static CodeMsg SESSION_ERROR = new CodeMsg(500215,"当前用户Session失效");

    //商品模块

    //订单模块
    public static CodeMsg ORDER_NOT_EXIIST = new CodeMsg(500400,"订单不存在");

    //秒杀模块
    public static CodeMsg MIAO_SHA_OVER = new CodeMsg(500500,"商品库存不足");
    public static CodeMsg REPEATE_MIAO_SHA = new CodeMsg(500501,"商品不能重复秒杀");
    public static CodeMsg MIAOSHA_FAIL = new CodeMsg(500502,"秒杀失败");
}
